<?php 
require_once 'sesi_login.php';
require_once 'konfigurasi.php';

fungsi('pengguna');

define('PAGE', 'Soal');
define('PAGE_ICO', 'icon-stats');
define('PAGE_URL', 'soal.php');

panggil_header();
koneksi_buka();

$soal_id = $_GET['soal_id'];

$no = $_GET['no'];
$id_siswa = ID_SISWA;
$text_d_q_soal = "select a.pertanyaan as d_pertanyaan, b.jumlah as s_jumlah, a.no as d_no, b.nama as s_nama, c.nama as pilihan_a, d.nama as pilihan_b, e.nama as pilihan_c, f.nama as pilihan_d
						from d_soal a 
							LEFT JOIN soal b ON a.soal_id = b.id 
							LEFT JOIN (select * from pilihan where no=1) c on a.id=c.d_soal 
							LEFT JOIN (select * from pilihan where no=2) d on a.id=d.d_soal 
							LEFT JOIN (select * from pilihan where no=3) e on a.id=e.d_soal 
							LEFT JOIN (select * from pilihan where no=4) f on a.id=f.d_soal 
						where a.soal_id = $soal_id and a.no = $no";
$q_d_soal = mysql_query($text_d_q_soal);
$dt_d_soal = mysql_fetch_array($q_d_soal);			

?>

<div class="content">
                
	<div class="page-header">
		<div class="icon">
			<span class="ico-arrow-right"></span>
		</div> 
		<h1> Soal<small>SDN I</small></h1>
	</div>
	
	<div class="row-fluid">
		<div class="span12">                

			<div class="block">
				<form id="validate" method="post" action="functions/crud/crud_d_hasil_soal.php">
					<div class="head">                                
						<h2><?php echo $dt_d_soal['s_nama']; ?></h2>
						<ul class="buttons">             
							<li><a href="#" onClick="source('form_pa'); return false;"><div class="icon"><span class="ico-info"></span></div></a></li>
						</ul>                                                                  
					</div> 
					<div class="row-fluid">                            
						<div class="span12"><?php echo $dt_d_soal['d_no'].". ".$dt_d_soal['d_pertanyaan']; ?></div>
					</div> 
					<div class="row-fluid">                            
							<div class="span6">
								<input type="radio" name="pilihan" value="1"/><?php echo "a. ".$dt_d_soal['pilihan_a'];?> 
							</div>
							<div class="span6">
								<input type="radio" name="pilihan" value="2"/><?php echo "b. ".$dt_d_soal['pilihan_b'];?> 
							</div>
					</div>                 
					<div class="row-fluid">                            
							<div class="span6">
								<input type="radio" name="pilihan" value="3"/><?php echo "c. ".$dt_d_soal['pilihan_c'];?> 
							</div>
							<div class="span6">
								<input type="radio" name="pilihan" value="4"/><?php echo "d. ".$dt_d_soal['pilihan_d'];?> 
							</div>
					</div>    
					
					<div class="row-fluid">
						<div align="right" class="span12">    
							<!-- <button class="btn btn-primary" type="button">Lihat</button> --> 							
							<input type="submit" value="Ok" name="lanjut" class="btn" />
							<button class="btn btn-warning" id="btn-kembali" type="button">kembali</button> 
							<input type="hidden" name="soal_id" value="<?php echo $soal_id; ?>"/>
							<input type="hidden" name="hasil" value="<?php echo HASIL; ?>"/>
							<input type="hidden" name="id_siswa" value="<?php echo $id_siswa; ?>"/>
							<input type="hidden" name="no" value="<?php echo $no; ?>"/>
							<input type="hidden" name="lanjut" 
								value="<?php 
											$jumlah = $dt_d_soal['s_jumlah'];
											if($no== $jumlah){
												echo 'end';
											}
											else{
												echo $no=$no+1;
											}?>"/>
							<input type="hidden" name="kembali" 
								value="<?php 
											if($no==1){
												echo $jumlah;
											}
											else{
												echo $no=$no-1;
											}?>"/>       
						</div>   
					</div>
				</form>    
			</div>
		</div>  
	</div> 

</div>
<div class="dialog" id="source" style="display: none;" title="Source"></div>

<?php
panggil_footer();
?>
